package com.chb.system.controller.apis;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chb.system.service.OperLogService;
import com.chb.system.vo.LoginInfoVo;
import com.chb.system.vo.OperLogVo;
import com.hos.entity.sys.LoginInfo;
import com.hos.entity.sys.OperLog;
import com.hos.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：张家琪
 * @date ：Created in 2023/12/18 15:16
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("system/api/operLog")
@Api(value = "操作日志管理接口", tags = "操作日志管理接口")
public class APIOperLogController {
    @Autowired
    private OperLogService operLogService;

    @GetMapping("getAllOperLog")
    @ApiOperation(value = "获取操作日志")
    public Result<List<OperLog>> getAllOperLog() {
        return new Result<>(200, "查询成功", operLogService.getAllOperLog());
    }

    @PostMapping("selectOperLogByCond")
    @ApiOperation(value = "条件查询操作日志")
    public Result<Page<OperLog>> selectOperLogByCond(@RequestBody OperLogVo operLogVo) {
        return new Result<>(200, "请求成功", operLogService.selectOperLogByCond(operLogVo));
    }

    @DeleteMapping("deleteOperLogByOperLogIds/{ids}")
    @ApiOperation(value = "根据操作日志ID永久删除操作日志")
    public Result<Integer> deleteOperLogByOperLogIds(@PathVariable List<Long> ids) {
        return new Result<>(200, "删除成功", operLogService.deleteOperLogByIds(ids));
    }

    @DeleteMapping("clearOperLog")
    @ApiOperation(value = " 清空登录日志")
    public Result<Integer> clearOperLog() {
        return new Result<>(200, "清空成功", operLogService.clearOperLog());
    }
}